package cn.ctodb.divination.action;

import cn.ctodb.divination.NameGlobal;
import cn.ctodb.divination.service.*;
import cn.ctodb.divination.service.dto.WuGe;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.inject.Inject;

/**
 * Created by cc on 2017/2/5.
 */
@Controller
public class WugeAction {

    @Inject
    private WuGeService wuGeService;
    @Inject
    private BaseService baseService;
    @Inject
    private HzwxService hzwxService;
    @Inject
    private ByslService byslService;
    @Inject
    private SancaiService sancaiService;

    @RequestMapping("/wg/{xing}/{ming}")
    public String sm(@PathVariable String xing, @PathVariable String ming, ModelMap modelMap) {
        WuGe wuGe = wuGeService.js(xing, ming);
        modelMap.put("xing", xing);
        modelMap.put("ming", ming);
        modelMap.put("wuge", wuGe);
        modelMap.put("zywx", hzwxService.zywx(xing, ming));
        modelMap.put("bs", baseService);
        modelMap.put("byslService", byslService);
        modelMap.put("sancaiService", sancaiService);
        NameGlobal.add(xing, ming);
        return "wg";
    }

}
